home *** CD-ROM | disk | FTP | other *** search
-
- function units_starship_setup()
- units_setup(7,false,nil)
- uniGetExecutor():setLocalOrientation(0,1,0,0,0,1)
- end
-
- function units_starship_resetup()
- units_setup(7,false,nil)
- uniGetExecutor():setLocalOrientation(0,1,0,0,0,1)
- end
-
- function units_starship_select()
- units_select(12,1)
- end
-
- function units_starship_unselect()
- units_unselect()
- end
-
- function units_starship_selectenemy()
- uniGetExecutor():addSimpleEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY)
- end
-
- function units_starship_damaged()
- uniGetExecutor():applyDamage(uniGetLife())
- end
-
- function units_starship_highlight()
- local ship = uniGetExecutor()
- local wPos = ship:getWorldPosition()
- -- ship:setLocalPosition(wPos.x,wPos.y + 300,wPos.z + 300)
- ship:setLocalPosition(wPos.x,wPos.y,wPos.z + 300)
- wPos.y = getHeight(wPos.x,wPos.z)
- wPos.z = wPos.z + 100
- waitDeath(ship:linearFly(wPos,300,true))
- uniSetLife(1.0)
- ship:executeCommand(ENC_DAMAGED)
- -- uniGetExecutor():applyDamage(2.0)
- end
-
- function units_starship_explode()
- units_explode_xxl1()
- end
-
- function units_starship_move()
- local ship = uniGetExecutor()
- local pos = D3DXVECTOR3:new(0,0,0)
-
- local to = D3DXVECTOR3:new(uniGetPosition().x - ship:getWorldPosition().x, 0, uniGetPosition().z - ship:getWorldPosition().z)
-
- local top_smoke1 = ship:getBone(ENBT_FIRE2,6):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY3)
- local top_smoke2 = ship:getBone(ENBT_FIRE2,7):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY3)
- local top_smoke3 = ship:getBone(ENBT_FIRE2,9):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY3)
-
- if ( to.x * to.x + to.z * to.z > 10 ) then
-
- local down_engine1 = ship:getBone(ENBT_FIRE2,5):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY1)
- local down_engine2 = ship:getBone(ENBT_FIRE2,8):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY1)
- local down_engine3 = ship:getBone(ENBT_FIRE2,0):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY1)
-
-
- pos = ship:getWorldPosition()
- pos.y = pos.y + 250
- waitDeath(ship:starshipFly(pos,30))
-
-
- waitDeath(ship:addRotationEffect(ENET_EFFECT_ROTATE_UNIT,MATH_PI * 0.25))
-
- down_engine1:suspendedDestroy(1.5)
- down_engine2:suspendedDestroy(1.5)
- down_engine3:suspendedDestroy(1.5)
-
- pos = uniGetPosition()
- pos.y = pos.y + 250
-
- local back_engine1 = ship:getBone(ENBT_FIRE2,1):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY2)
- local back_engine2 = ship:getBone(ENBT_FIRE2,2):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY2)
- local back_engine3 = ship:getBone(ENBT_FIRE2,3):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY2)
- local back_engine4 = ship:getBone(ENBT_FIRE2,4):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY2)
-
- waitDeath(ship:starshipFly(pos,200))
-
- back_engine1:suspendedDestroy(2.5)
- back_engine2:suspendedDestroy(2.5)
- back_engine3:suspendedDestroy(2.5)
- back_engine4:suspendedDestroy(2.5)
- end
-
- pos:delete()
- to:delete()
-
- local down_engine1 = ship:getBone(ENBT_FIRE2,5):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY1)
- local down_engine2 = ship:getBone(ENBT_FIRE2,8):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY1)
- local down_engine3 = ship:getBone(ENBT_FIRE2,0):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY1)
-
-
- local rot = ship:addRotationEffect(ENET_EFFECT_ROTATE_RADAR,MATH_PI/3)
- waitDeath(ship:starshipFly(uniGetPosition(),200))
- rot:destroy()
-
- down_engine1:suspendedDestroy(1.5)
- down_engine2:suspendedDestroy(1.5)
- down_engine3:suspendedDestroy(1.5)
-
-
- top_smoke1:suspendedDestroy(2.5)
- top_smoke2:suspendedDestroy(2.5)
- top_smoke3:suspendedDestroy(2.5)
- end
-
- function units_starship_fire()
- local ship = uniGetExecutor()
- local pos = ship:getWorldPosition()
-
- local top_smoke1 = ship:getBone(ENBT_FIRE2,6):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY3)
- local top_smoke2 = ship:getBone(ENBT_FIRE2,7):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY3)
- local top_smoke3 = ship:getBone(ENBT_FIRE2,9):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY3)
-
- local down_engine1 = ship:getBone(ENBT_FIRE2,5):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY1)
- local down_engine2 = ship:getBone(ENBT_FIRE2,8):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY1)
- local down_engine3 = ship:getBone(ENBT_FIRE2,0):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY1)
-
- local rot = ship:addRotationEffect(ENET_EFFECT_ROTATE_RADAR,MATH_PI/3)
-
- pos.y = pos.y + uniGetMaxLife()
- waitDeath(ship:starshipFly(pos,200))
- rot:destroy()
-
- down_engine1:suspendedDestroy(1.5)
- down_engine2:suspendedDestroy(1.5)
- down_engine3:suspendedDestroy(1.5)
-
- top_smoke1:suspendedDestroy(2.5)
- top_smoke2:suspendedDestroy(2.5)
- top_smoke3:suspendedDestroy(2.5)
- end
-
- function units_starship_load()
- local unit = uniGetExecutor()
- local cargo = uniGetTarget()
- units_waitCommandByUID(cargo,unit:getCurrentCommandUID() - 1)
- cargo:setVisibility(true,false)
- uniSetPosition(unit:getBone(ENBT_FIRE1):getWorldPosition())
- units_load_shrink(cargo)
- local ground = units_addGround(unit,ENET_LTRANSPORT_GROUND)
- local movecmd_uid = cargo:executeCommand(ENC_MOVE,true)
- cargo:terminateCommand()
- while(cargo:getCurrentCommandUID() == movecmd_uid) do pause() end
- cargo:setTransformOwner(units_findfreefirespot(unit,1))
- unit:setCurrentAnimationRepeatCount(0)
- cargo:setVisibility(false,false)
- end
-
- function units_starship_unload()
-
- local ship = uniGetExecutor()
-
- local top_smoke1 = ship:getBone(ENBT_FIRE2,6):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY3)
- local top_smoke2 = ship:getBone(ENBT_FIRE2,7):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY3)
- local top_smoke3 = ship:getBone(ENBT_FIRE2,9):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY3)
-
- local down_engine1 = ship:getBone(ENBT_FIRE2,5):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY1)
- local down_engine2 = ship:getBone(ENBT_FIRE2,8):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY1)
- local down_engine3 = ship:getBone(ENBT_FIRE2,0):addSimpleEffect(ENET_EFFECT_PS_STARSHIP_FLY1)
-
- local unit = uniGetExecutor()
- local cargo = uniGetTarget()
- units_waitCommandByUID(cargo,unit:getCurrentCommandUID() - 1)
- cargo:setLocalOrientation(0,1,0,0,0,-1)
- cargo:setTransformOwner()
- cargo:setScale(0.4,0.4,0.4)
- cargo:setVisibility(true,false)
- local movecmd_uid = cargo:executeCommand(ENC_MOVE,true)
- cargo:terminateCommand()
- while(cargo:getCurrentCommandUID() == movecmd_uid) do pause() end
- units_unload_growth(cargo)
- cargo:setVisibility(true,true)
-
- down_engine1:suspendedDestroy(1.5)
- down_engine2:suspendedDestroy(1.5)
- down_engine3:suspendedDestroy(1.5)
-
- top_smoke1:suspendedDestroy(2.5)
- top_smoke2:suspendedDestroy(2.5)
- top_smoke3:suspendedDestroy(2.5)
- end
-
- registerCommand(ENSCRIPTSET_STARSHIP,ENC_MOVE,"units_starship_move")
- registerCommand(ENSCRIPTSET_STARSHIP,ENC_FIRE1,"units_starship_fire")
- registerCommand(ENSCRIPTSET_STARSHIP,ENC_FIRE2,"units_starship_fire")
- registerCommand(ENSCRIPTSET_STARSHIP,ENC_SELECT,"units_starship_select")
- registerCommand(ENSCRIPTSET_STARSHIP,ENC_SELECTENEMY,"units_starship_selectenemy")
- registerCommand(ENSCRIPTSET_STARSHIP,ENC_UNSELECT,"units_starship_unselect")
- registerCommand(ENSCRIPTSET_STARSHIP,ENC_SETUP,"units_starship_setup")
- registerCommand(ENSCRIPTSET_STARSHIP,ENC_RESETUP,"units_starship_resetup")
- registerCommand(ENSCRIPTSET_STARSHIP,ENC_DAMAGED,"units_starship_damaged")
- registerCommand(ENSCRIPTSET_STARSHIP,ENC_EXPLODE,"units_starship_explode")
- registerCommand(ENSCRIPTSET_STARSHIP,ENC_HIGHLIGHT,"units_starship_highlight")
- registerCommand(ENSCRIPTSET_STARSHIP,ENC_INSIDE,"units_inside")
- registerCommand(ENSCRIPTSET_STARSHIP,ENC_UNLOAD,"units_starship_unload")
- registerCommand(ENSCRIPTSET_STARSHIP,ENC_LOAD,"units_starship_load")
-
- -- make description of unit
- desc = getEffectDescriptionP(ENET_UNIT_STARSHIP)
- desc.ClassID = ENCLASS_MESHINSTANCE
- desc.EffectClassType = ENECT_GEOMETRY
- desc.FileName = "starship.rmd"
- desc.ScriptSet = ENSCRIPTSET_STARSHIP
- desc.MoveType = ENMOVE_FLY
- desc.RenderType = ENRENDERTYPE_GEOMETRY
- desc.Material = ENMAT_RIGIDSKINNEDMESH
- desc.MaterialColors = units_materialcolors_human
-
- -- shadow
- desc = getEffectDescriptionP(ENET_GEOMETRY_STARSHIP_SHADOW)
- desc.ClassID = ENCLASS_MESHINSTANCE
- desc.EffectClassType = ENECT_GEOMETRY
- desc.FileName = "starship_shadow.rmd"
- desc.RenderType = ENRENDERTYPE_SHADOW
- desc.Material = ENMAT_SHADOW
- desc.MaterialColors = units_materialcolors_shadow
-
- -- register new unit to logic
- unitDesc = logic_getUnitDescP(98)
- unitDesc.group = 0
- unitDesc.order = 0
- unitDesc.unit_res_id = ENET_UNIT_STARSHIP
- unitDesc.unit_icon_id = "Spaceship_h_small_normal.dds"
- unitDesc.active_id = "Spaceship_h_small_active.dds"
- unitDesc.pressed_id = "Spaceship_h_small_pressed.dds"
- unitDesc.big_icon_id = "Spaceship_ico.dds"
- unitDesc.small_icon_id = "Smallrobot_u_stats.dds"
- unitDesc.HP = 1000
- unitDesc.MP = 10
- unitDesc.WR = 1
- unitDesc.min_WR = 1
- unitDesc.WD = 1
- unitDesc.WR2 = 0
- unitDesc.min_WR2 = 0
- unitDesc.WD2 = 0
- unitDesc.ability = 0
- unitDesc.transport = 6
- unitDesc.value = 1
- unitDesc.race = 0
- unitDesc.fire_pause = 0.2
- unitDesc.move_pause = 0.5
- unitDesc.unit_info_scale = 0.08
- unitDesc.scn_name = "STARSHIP"
-
- ------------------------------------------------------------------------------------------------------
- ------------------------ effects related to unit------------------------------------------------------
- ------------------------------------------------------------------------------------------------------
- desc = getEffectDescription(ENET_EFFECT_GEOMETRY_VEGETATION_FURPALM)
- desc.FileName = "ponton_ground.smd"
- desc.effectUsageType = ENEUT_GENERIC
- desc.Geometry.isCollisionable = true
- changeEffect(ENET_PONTON_GROUND,desc)
-